<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class="full-center-content-scroll-noheader ">
			<h:form id="form3">
				<p:growl id="msgs" showDetail="true" />
				<div class="box box-solid with-border">
					<div class="box-header">
						<p:outputLabel for="model" value="保护型号:" style="margin-right:5px;margin-left:5px;" />
						<p:inputText id="model" placeholder="输入保护型号进行查询" value="#{componentDictionaryController.protectModel}" />
						<p:commandButton value="查询" actionListener="#{componentDictionaryController.search}"
							update="dataTb" icon="ui-icon-search" style="margin-left:10px">
						</p:commandButton>
						<p:commandButton value="重置" actionListener="#{componentDictionaryController.reset}"
							update="dataTb model" icon="ui-icon-refresh" style="margin-left:5px">
						</p:commandButton>
					</div>
				</div>
				<p:toolbar id="btnBar">
					<f:facet name="left">
						<p:commandButton value="新增" id="createBtn"
							rendered="#{s:hasPermission(session,'xtsz_xtzd_dzyjzd_xj')}"
							oncomplete="PF('editDlg').show()" actionListener="#{componentDictionaryController.preCreate}"
							update="editForm" icon="fa fa-plus" />
						<p:commandButton value="编辑" id="editBtn"
							rendered="#{s:hasPermission(session,'xtsz_xtzd_dzyjzd_bj')}"
							disabled="#{componentDictionaryController.current==null}" oncomplete="PF('editDlg').show()"
							update="editForm" icon="fa fa-pencil" />
						<p:commandButton value="删除" id="delBtn"
							rendered="#{s:hasPermission(session,'xtsz_xtzd_dzyjzd_sc')}"
							disabled="#{componentDictionaryController.current==null}"
							actionListener="#{componentDictionaryController.delete()}"
							update="dataTb btnBar" icon="fa fa-trash">
							<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:dataTable id="dataTb" var="record" emptyMessage="无记录" value="#{componentDictionaryController.compontentDics}" rowKey="#{record.id}"
					paginator="true" paginatorPosition="bottom" sortBy="#{record.protectModel}"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rows="20" rowsPerPageTemplate="20,50,100" rowIndexVar="ite"
					selection="#{componentDictionaryController.current}" style="margin-bottom:20px;text-align: center">
					<p:ajax event="rowSelectRadio" update="form3:btnBar " />
					<p:column selectionMode="single" style="width:60px" />
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{componentDictionaryController.compontentDics.size()} 条记录" style="margin-right:20px;" />
					</f:facet>
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="保护型号" groupRow="true">
						<h:outputText value="#{record.protectModel}"  />
					</p:column>
					<p:column headerText="动作元件">
						<h:outputText value="#{record.actionComponent}" />
					</p:column>
					<p:column headerText="功能分类">
						<h:outputText value="#{record.funClassification}" />
					</p:column>
					<p:summaryRow>
			            <p:column colspan="5" style="text-align:right">
			                <h:outputText value="占位符" style="opacity:0"/>
			            </p:column>
			        </p:summaryRow>
				</p:dataTable>
			</h:form>
			<h:form id="editForm">
				<p:dialog widgetVar="editDlg" header="编辑字典" modal="true" id="editDlg" width="400" height="200">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton id="createSaveBtn" value="保存" style="float: right;" icon="fa fa-floppy-o"
								update="form3:dataTb form3:msgs form3:delBtn form3:editBtn"
								actionListener="#{componentDictionaryController.save}" oncomplete="PF('editDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="editDetail" style=" text-align:center; width:100%;">
						<p:panelGrid columns="2" style="width:100%">
							<h:outputText value="保护型号" />
							<p:inputText value="#{componentDictionaryController.current.protectModel}"></p:inputText>
							<h:outputText value="动作元件" />
							<p:inputText value="#{componentDictionaryController.current.actionComponent}"></p:inputText>
							<h:outputText value="功能分类" />
							<!-- <p:inputText value="#{componentDictionaryController.current.funClassification}"></p:inputText> -->
							<p:autoComplete id="startionSearch" dropdown="true" placeholder="" scrollHeight="400"
							value="#{componentDictionaryController.current.funClassification}" style="width:160px"
							completeMethod="#{componentDictionaryController.complateStation}">
						</p:autoComplete>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="/resources/js/tables/mytable.js"></script>
		<script src="/resources/js/mymodal.js"></script>
	</ui:define>
</ui:composition>
